#!/usr/bin/bash
#


# check current system =? CentOS
# The current script supports the use of the centos distribution, 
# and centos 7 is recommended; the script execution environment is bash
if [ -f /etc/redhat-release ];then
	echo "$(cat /etc/redhat-release)"
else
  echo "this system is not CentOS"
  exit 1
fi

function initial_environment() {
  # set off firewalld & selinux
  systemctl disable --now firewalld
  sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
  yum -y install  net-tools bridge-utils qemu-kvm libvirt virt-install libguestfs libguestfs-tools
  systemctl enable --now libvirtd.service
  # initial directory
  mkdir -p /kvm/{vdisks,isos,modify}
  modprobe -a kvm
}

initial_environment

